package com.wgchao.authmanager.infrastructure.jpa.repository;

import com.wgchao.authmanager.infrastructure.jpa.entity.RoleInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RoleInfoJpaRepository extends JpaRepository<RoleInfo, Long>, JpaSpecificationExecutor<RoleInfo> {
    RoleInfo findFirstByAgencyCodeAndRoleNameAndDelIsFalse(String agencyCode, String roleName);
    RoleInfo findFirstByAgencyCodeAndRoleName(String agencyCode, String roleName);
    Page<RoleInfo> findAll(Specification specification, Pageable pageable);
    List<RoleInfo> findAllByAgencyCodeAndDelIsFalseAndDisabledIsFalse(String agencyCode);
}
